let app = getApp();
Page({
  data: {
    arrData:null,
    arrFlag:false,
    address:null,
  },
  onLoad(options) {
    let that =this;
    wx.getStorage({
      key: 'openid',
      success(res) {
        that.ajaxAddress(res.data);
      }
    });
    this.setData({
      address:options
    })
  },
  //点击选中地址返回
  itemTap(res){
    console.log(res);
    let data = res.currentTarget.dataset, urls = '', address='';
    address = this.data.address;
    urls += '?sumAll=' + address.sumAll + '&priceAll=' + address.priceAll + '&info=' + address.info;
    urls += '&name=' + data.name + '&address=' + data.address + '&phone=' + data.phone;
    wx.navigateTo({
      url: '/pages/submitOrder/submitOrder' + urls
    })
  },
  addSubmit(){
    this.setData({
      arrFlag: false
    })    
  },
  addCancel(){
    this.setData({
      arrFlag: false
    })    
  },
  addRess(){
    this.setData({
      arrFlag:true
    })    
  },
  ajaxAddress(openid){
    let that = this;
    app.get('DingDanDiZhi', {
      Action: 'getlishishouhuodizhi',
      Openid: openid
    }).then((res)=>{
      that.setData({
        arrData:res
      });      
    })
  }
})